package com.aliyun.messagemgt.common.exceptions;


import com.aliyun.messagemgt.common.enums.BusinessErrorCode;

public class BusinessException extends RuntimeException {
	private static final long serialVersionUID = 1L;
	  
	private String code;
	  
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	/**
	   * 使用枚举传参
	   *
	   * @param errorCode 异常枚举
	   */
	  public BusinessException(BusinessErrorCode errorCode) {
	    super(errorCode.getMessage());
	    this.code = errorCode.getCode();
	  }
	
	  /**
	   * 使用自定义消息
	   *
	   * @param code 值
	   * @param msg 详情
	   */
	  public BusinessException(String code, String msg) {
	    super(msg);
	    this.code = code;
	  }

}